package com.fortune.common.spring.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.fortune.common.spring.jackson.deserializer.DateDeserializer;
import com.fortune.common.spring.jackson.serializer.DateSerializer;

@Configuration
public class JacksonConfig {
	@Bean(name="objectMapper")
	public ObjectMapper objectMapper() {
		Jackson2ObjectMapperBuilder builder = Jackson2ObjectMapperBuilder.json();
		builder.deserializers(new DateDeserializer());
		builder.serializers(new DateSerializer());
		ObjectMapper objectMapper = builder.build();
		return objectMapper;
	}
}
